package com.dashu.authority.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

@Table(name = "menu")
public class Menu {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 菜单名称
     */
    @Column(name = "menu_name")
    private String menuName;

    /**
     * 菜单连接
     */
    @Column(name = "menu_url")
    private String menuUrl;

    /**
     * 图标
     */
    @Column(name = "icon_cls")
    private String iconCls;

    /**
     * 父菜单ID
     */
    @Column(name = "parent_id")
    private Integer parentId;

    /**
     * 系统ID
     */
    @Column(name = "application_id")
    private Integer applicationId;

    /**
     * 排序
     */
    @Column(name = "menu_seq_no")
    private Integer menuSeqNo;

    /**
     * 1=Enabled, 0=Disabled
     */
    private Boolean status;

    /**
     * 1=Normal, 0=Deleted
     */
    @Column(name = "is_delete")
    private Boolean isDelete;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;
    
    @Transient
    private String applicationName;
    @Transient
    private String parentName;
    @Transient
    private String text;  //EasyUI对应字段  显示
    private Boolean checked = false; //EasyUI对应字段 是否选中
    
    private List<Menu> children = new ArrayList<>();
    
    private Long authority;

    /**
     * @return id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 获取菜单名称
     *
     * @return menu_name - 菜单名称
     */
    public String getMenuName() {
        return menuName;
    }

    /**
     * 设置菜单名称
     *
     * @param menuName 菜单名称
     */
    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    /**
     * 获取菜单连接
     *
     * @return menu_url - 菜单连接
     */
    public String getMenuUrl() {
        return menuUrl;
    }

    /**
     * 设置菜单连接
     *
     * @param menuUrl 菜单连接
     */
    public void setMenuUrl(String menuUrl) {
        this.menuUrl = menuUrl;
    }

    /**
     * 获取菜单连接
     *
     * @return icon_cls - 菜单连接
     */
    public String getIconCls() {
        return iconCls;
    }

    /**
     * 设置菜单连接
     *
     * @param iconCls 菜单连接
     */
    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    /**
     * 获取父菜单ID
     *
     * @return parent_id - 父菜单ID
     */
    public Integer getParentId() {
        return parentId;
    }

    /**
     * 设置父菜单ID
     *
     * @param parentId 父菜单ID
     */
    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    /**
     * 获取系统ID
     *
     * @return application_id - 系统ID
     */
    public Integer getApplicationId() {
        return applicationId;
    }

    /**
     * 设置系统ID
     *
     * @param applicationId 系统ID
     */
    public void setApplicationId(Integer applicationId) {
        this.applicationId = applicationId;
    }

    /**
     * 获取菜单连接
     *
     * @return menu_seq_no - 菜单连接
     */
    public Integer getMenuSeqNo() {
        return menuSeqNo;
    }

    /**
     * 设置菜单连接
     *
     * @param menuSeqNo 菜单连接
     */
    public void setMenuSeqNo(Integer menuSeqNo) {
        this.menuSeqNo = menuSeqNo;
    }

    /**
     * 获取1=Enabled, 0=Disabled
     *
     * @return status - 1=Enabled, 0=Disabled
     */
    public Boolean getStatus() {
        return status;
    }

    /**
     * 设置1=Enabled, 0=Disabled
     *
     * @param status 1=Enabled, 0=Disabled
     */
    public void setStatus(Boolean status) {
        this.status = status;
    }

    /**
     * 获取1=Normal, 0=Deleted
     *
     * @return is_delete - 1=Normal, 0=Deleted
     */
    public Boolean getIsDelete() {
        return isDelete;
    }

    /**
     * 设置1=Normal, 0=Deleted
     *
     * @param isDelete 1=Normal, 0=Deleted
     */
    public void setIsDelete(Boolean isDelete) {
        this.isDelete = isDelete;
    }

    /**
     * 获取创建时间
     *
     * @return create_time - 创建时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 设置创建时间
     *
     * @param createTime 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * 获取更新时间
     *
     * @return update_time - 更新时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * 设置更新时间
     *
     * @param updateTime 更新时间
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

	public String getApplicationName() {
		return applicationName;
	}

	public void setApplicationName(String applicationName) {
		this.applicationName = applicationName;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public List<Menu> getChildren() {
		return children;
	}

	public void setChildren(List<Menu> children) {
		this.children = children;
	}

	public Long getAuthority() {
		return authority;
	}

	public void setAuthority(Long authority) {
		this.authority = authority;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}
    
}